/**
 * Application Application.java
 */

package CCT220_Aula21_Exercicio02_13106;


import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;


/**
 * <div style="border-style:double;">
 * Project: CCT220
 * </br>Package: CCT220_Aula21_Exercicio02_13106
 * </br>Class: Application
 * </br>Created by marcel
 * </br>Description:
 * </div>
 * 
 * @author marcel
 * @author 13106
 * 
 */
public class Application extends JFrame {
	/**
	 * long serialVersionUID
	 */
	private static final long serialVersionUID = 1L;


	/**
	 * <div style="border-style:double;">
	 * Constructor for
	 * </br>CCT220_Aula21_Exercicio02_13106::Application
	 * </br>LastChange: 08/11/2011 23:34:02 by marcel
	 * </div>
	 * 
	 */
	public Application() {

		// Cria os painéis e seta os layouts
		JPanel p1 = new JPanel();
		p1.setLayout(new BoxLayout(p1, BoxLayout.Y_AXIS));

		JPanel pTop = new JPanel();
		pTop.setLayout(new BoxLayout(pTop, BoxLayout.X_AXIS));
		pTop.setAlignmentX(0.5f);

		JPanel pCen = new JPanel();
		pCen.setLayout(new BoxLayout(pCen, BoxLayout.X_AXIS));
		pCen.setAlignmentX(0.5f);

		JPanel pBot = new JPanel();
		pBot.setLayout(new BoxLayout(pBot, BoxLayout.X_AXIS));
		pBot.setAlignmentX(0.5f);

		// Cria os componentes e seta o alinhamento no centro (0.5f)
		JButton b1 = new JButton(" TOP-LEFT ");
		b1.setAlignmentX(0.5f);
		JButton b2 = new JButton("TOP");
		b2.setAlignmentX(0.5f);
		JButton b3 = new JButton(" TOP-RIGHT ");
		b3.setAlignmentY(0.5f);

		JButton b4 = new JButton("LEFT");
		b4.setAlignmentY(0.5f);
		JButton b5 = new JButton("CENTER");
		b5.setAlignmentY(0.5f);
		JButton b6 = new JButton("RIGHT");
		b6.setAlignmentY(0.5f);

		JButton b7 = new JButton("BOTTOM-LEFT");
		b7.setAlignmentY(0.5f);
		JButton b8 = new JButton("BOTTOM");
		b8.setAlignmentY(0.5f);
		JButton b9 = new JButton("BOTTOM-RIGHT");
		b9.setAlignmentY(0.5f);

		// Adiciona os componentes
		pTop.add(b1);
		pTop.add(Box.createHorizontalGlue());
		pTop.add(b2);
		pTop.add(Box.createHorizontalGlue());
		pTop.add(b3);

		pCen.add(b4);
		pCen.add(Box.createHorizontalGlue());
		pCen.add(b5);
		pCen.add(Box.createHorizontalGlue());
		pCen.add(b6);

		pBot.add(b7);
		pBot.add(Box.createHorizontalGlue());
		pBot.add(b8);
		pBot.add(Box.createHorizontalGlue());
		pBot.add(b9);

		p1.add(pTop);
		p1.add(Box.createVerticalGlue());
		p1.add(pCen);
		p1.add(Box.createVerticalGlue());
		p1.add(pBot);

		// Inicializa o frame
		add(p1);
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setSize(400, 170);
		setTitle("BoxLayoutDemo");
		setVisible(true);
	}


	/**
	 * <div style="border-style:double;">
	 * Method:CCT220_Aula21_Exercicio02_13106::Application::main
	 * </br>Last Change: 08/11/2011 23:32:22 by marcel
	 * </br>Description:
	 * </div>
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		new Application();

	}
}
